package cn.edu.jju.stepcounter2.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by roor on 2016/12/8.
 */

public class DayDataAdapter extends PagerAdapter {
    List<View> dayDatas = new ArrayList<>();
    public DayDataAdapter(List<View> dayDatas) {
        this.dayDatas = dayDatas;

    }


    @Override
    public int getCount() {
        return dayDatas.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(dayDatas.get(position));
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(dayDatas.get(position));
        return dayDatas.get(position);
    }

}
